<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="/jsp/taglib.jsp"%>
<!DOCTYPE html>
<html>
<head>

    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>jqGird</title>
    <meta name="keywords" content="">
    <meta name="description" content="">

    <link rel="shortcut icon" href="favicon.ico">
    <link href="${ctxStatic}/plugins/h+/css/bootstrap.min14ed.css?v=3.3.6" rel="stylesheet">
    <link href="${ctxStatic}/plugins/h+/css/plugins/bootstrap-table/bootstrap-table.min.css" rel="stylesheet">
    <link href="${ctxStatic}/plugins/h+/css/animate.min.css" rel="stylesheet">
    <%--<link href="${ctxStatic}/plugins/h+/css/style.min862f.css?v=4.1.0" rel="stylesheet">--%>
    <link rel="stylesheet" type="text/css" href="${ctxStatic}/plugins/h+/css/plugins/webuploader/webuploader.css">
    <link href="${ctxStatic}/plugins/h+/css/plugins/sweetalert/sweetalert.css" rel="stylesheet">

    <link href="${ctxStatic}/plugins/h+/css/font-awesome.min.css" rel="stylesheet">
    <link href="${ctxStatic}/plugins/h+/css/plugins/iCheck/custom.css" rel="stylesheet">
    <link href="${ctxStatic}/plugins/h+/css/plugins/chosen/chosen.css" rel="stylesheet">
    <link href="${ctxStatic}/plugins/h+/css/plugins/colorpicker/css/bootstrap-colorpicker.min.css" rel="stylesheet">
    <link href="${ctxStatic}/plugins/h+/css/plugins/cropper/cropper.min.css" rel="stylesheet">
    <link href="${ctxStatic}/plugins/h+/css/plugins/switchery/switchery.css" rel="stylesheet">
    <link href="${ctxStatic}/plugins/h+/css/plugins/jasny/jasny-bootstrap.min.css" rel="stylesheet">
    <link href="${ctxStatic}/plugins/h+/css/plugins/nouslider/jquery.nouislider.css" rel="stylesheet">
    <link href="${ctxStatic}/plugins/h+/css/plugins/datapicker/datepicker3.css" rel="stylesheet">
    <link href="${ctxStatic}/plugins/h+/css/plugins/ionRangeSlider/ion.rangeSlider.css" rel="stylesheet">
    <link href="${ctxStatic}/plugins/h+/css/plugins/ionRangeSlider/ion.rangeSlider.skinFlat.css" rel="stylesheet">
    <link href="${ctxStatic}/plugins/h+/css/plugins/awesome-bootstrap-checkbox/awesome-bootstrap-checkbox.css" rel="stylesheet">
    <link href="${ctxStatic}/plugins/h+/css/plugins/clockpicker/clockpicker.css" rel="stylesheet">
    <link href="${ctxStatic}/plugins/h+/css/animate.min.css" rel="stylesheet">
    <link href="${ctxStatic}/plugins/h+/css/style.min.css?v=4.0.0" rel="stylesheet"><base target="_blank">
    <link href="${pageContext.request.contextPath}/resources/plugins/h+/css/plugins/jsTree/style.min.css" rel="stylesheet">
    <style>
        .ml10 {
            margin-left: 15px;
        }

    </style>
</head>
<div class="wrapper wrapper-content">
    <div class="panel-body">
        <div class="col-sm-12">
            <div class="ibox float-e-margins">
                <div class="ibox-content">
                    <form onsubmit="return  false" class="form-horizontal" id="signupForm">
                        <div class="form-group">
                            <label class="col-sm-3 control-label">所属商户：</label>
                            <div class="col-sm-8">
                                <select  class="chosen-select"  name="recharge90.brand_code" id="brand_name"></select>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label">久零券总额：</label>
                            <div class="col-sm-7">
                                <input id="total_90" step="0.01" name="recharge90.total90" class="form-control" type="number" aria-required="true" aria-invalid="false" >
                            </div>
                            <label class="col-sm-1 control-label">/元</label>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label">消费的人民币：</label>
                            <div class="col-sm-7">
                                <input id="total_rmb" step="0.01" name="recharge90.totalrmb" class="form-control" type="number" aria-required="true" aria-invalid="true" >
                            </div>
                            <label class="col-sm-1 control-label">/元</label>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label">备注：</label>
                            <div class="col-sm-8">
                                <input id="notes" name="recharge90.notes" class="form-control" type="text">
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label">业务代表：</label>
                            <div class="col-sm-8">
                                <select  class="chosen-select"  name="recharge90.biz_code" id="recharge_person_name"></select>
                            </div>
                        </div>
                        <div class="form-group">
                            <div class="col-sm-8 col-sm-offset-3">
                                <button class="btn btn-primary" onclick="doSubmit();">提交</button>
                                <button id="btn_close"  class="btn btn-primary" type="button">关闭</button>
                            </div>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>

<script src="${ctxStatic}/plugins/h+/js/jquery.min.js?v=2.1.4"></script>
<script src="${ctxStatic}/plugins/h+/js/bootstrap.min.js?v=3.3.6"></script>
<script src="${ctxStatic}/plugins/h+/js/plugins/bootstrap-table-master/bootstrap-table.js"></script>
<script src="${ctxStatic}/plugins/h+/js/plugins/bootstrap-table/bootstrap-table-mobile.min.js"></script>
<script src="${ctxStatic}/plugins/h+/js/plugins/bootstrap-table-master/locale/bootstrap-table-zh-CN.js"></script>
<script src="${ctxStatic}/plugins/h+/js/plugins/bootstrap-table-master/extensions/export/bootstrap-table-export.js"></script>
<script src="${ctxStatic}/plugins/h+/js/plugins/bootstrap-table-master/extensions/editable/bootstrap-table-editable.js"></script>
<script src="${ctxStatic}/plugins/h+/js/plugins/sweetalert/sweetalert.min.js"></script>
<script src="${ctxStatic}/plugins/h+/js/content.min.js?v=1.0.0"></script>
<script src="${ctxStatic}/plugins/h+/js/plugins/chosen/chosen.jquery.js"></script>
<script src="${ctxStatic}/plugins/h+/js/plugins/layer/laydate/laydate.js"></script>
<script>

</script>
<script type="text/javascript" src="http://tajs.qq.com/stats?sId=9051096" charset="UTF-8"></script>
<script type="text/javascript">
    var index = parent.layer.getFrameIndex(window.name); //获取窗口索引
    loadBrand();
    loadBizPerson();
    //给父页面传值
    $('#transmit').on('click', function(){

        $(parent.window.frames["iframe8"].document).find("#spancc").html("我被改变了");
        $(parent.window.frames["iframe8"].document).find("#exampleTablePagination").bootstrapTable('refresh');
        parent.layer.close(index);
    });

    //关闭iframe
    $('#btn_close').click(function(){
        parent.layer.close(index);
    });


    //加载商户
    function loadBrand(){
        $.ajax( {
            url:'${pageContext.request.contextPath}/merchant/getBrandListForSelect.ac',// 跳转到 action
            data:{},
            type:'post',
            cache:false,
            dataType:'json',
            success:function(data) {
                $("#brand_name").html("");
                var html='<option value="">请选择</option>';
                for(var i=0;i<data.length;i++)
                {
                    html+='<option value="'+data[i].brand_code+'">'+data[i].name+'</option>';
                }
                $("#brand_name").html(html);
                $("#brand_name").chosen({
                    no_results_text : "未找到此选项!",
                    width:"100%"
                });
                $("#brand_name").trigger("chosen:updated");
            },
            error : function() {
                alert("加载商圈列表失败！");
            }
        });
    }

    function loadBizPerson() {
        var url="${ctx}/bizperson/showBizPersonForList.ac";
        $.ajax({
            url:url,
            data:{
            },
            type:'post',
            cache:false,
            dataType:'json',
            success:function(data) {
                $("#recharge_person_name").html("");
                var html='<option value="">请选择</option>';
                for(var i=0;i<data.length;i++)
                {

                    html+='<option value="'+data[i].code+'">'+data[i].person_name+'</option>';

                }
                $("#recharge_person_name").html(html);
                $("#recharge_person_name").chosen({
                    no_results_text : "未找到此选项!",
                    width:"100%"
                });
                $("#recharge_person_name").trigger("chosen:updated");
            },
            error : function() {
                alert("异常！");
            }
        });
    }

    function doSubmit()
    {
        var brand=$("#brand_name").val();
        var total90=$("#total_90").val();
        var rmb90=$("#total_rmb").val();
        var bizcode=$("#recharge_person_name").val();



        var isOk=true;
        if(brand==null||brand==undefined||brand==''){alert("请选择商户");isOk= false;}
        if(total90==null||total90==undefined||total90==''){alert("请输入久零券总额");isOk= false;}
        if(rmb90==null||rmb90==undefined||rmb90==''){alert("请输入消费的人民币");isOk= false;}
        if(bizcode==null||bizcode==undefined||bizcode==''){alert("请选择业务代表色");isOk= false;}

        if(isOk){
            $.ajax( {
                url:'${pageContext.request.contextPath}/recharge90/doInsert.ac',// 跳转到 action
                data:$("#signupForm").serialize(),
                type:'post',
                cache:false,
                dataType:'json',
                success:function(data) {
                    if(data=="success")
                    {
                        alert("操作成功！");

                        parent.layer.close(index);
                    }else
                    {
                        alert(data);
                    }
                },
                error : function() {
                    alert("操作失败！");
                }
            });
        }
    }
</script>


</html>

